#include <algorithm>

using namespace std;

struct TreeNode
{
    int val;
    TreeNode *left;
    TreeNode *right;
};

class Solution
{
public:
    int treeDepth(TreeNode *root)
    {
        if (root == nullptr)
        {
            return 0;
        }
        return max(treeDepth(root->left), treeDepth(root->right)) + 1;
    }
};